package main

import "fmt"

// 声明接口
type Usb interface {
	Start()
	Stop()
}

type Phone struct {
}
type Camera struct {
}

// phone 实现接口
func (phone Phone) Start() {
	fmt.Println("手机start...")
}
func (phone Phone) Stop() {
	fmt.Println("手机stop...")
}

// camera 实现接口
func (camare Camera) Start() {
	fmt.Println("相机start...")
}
func (camare Camera) Stop() {
	fmt.Println("相机stop...")
}

type Computer struct {
}

func (c Computer) working(usb Usb) {
	usb.Start()
	usb.Stop()
}
func main() {
	computer := Computer{}
	phone := Phone{}
	camera := Camera{}
	computer.working(phone)
	computer.working(camera)
}
